package com.yaolifei.flower.core.utils;

import com.yaolifei.flower.core.GlobalException;

public class Assert {
	
	public static void notNull(Object obj) {
		notNull(obj, null);
	}
	
	public static void notNull(Object obj, String message) {
		if (obj == null) {
			throw new GlobalException(message);
		}
	}
	
	public static void isNull(Object obj, String message) {
		if (obj != null) {
			throw new GlobalException(message);
		}
	}
	
	public static void isTrue(boolean condition) {
		isTrue(condition, null);
	}
	
	public static void isTrue(boolean condition, String message) {
		if (!condition) {
			throw new GlobalException(message);
		}
	}
	
	public static void isFalse(boolean condition) {
		isFalse(condition);
	}
	
	public static void isFalse(boolean condition, String message) {
		if (condition) {
			throw new GlobalException(message);
		}
	}
	
}
